﻿using ConmonDateModel.ResponseBase.Base;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConmonDateModel.ResponseBase
{
    /// <summary>
    /// 返回结果Body部分
    /// </summary>
    public class ResponseBody
    {
        /// <summary>
        /// 状态码
        /// </summary>
        [JsonProperty("code")]
        [JsonRequired]
        [DefaultValue(ErrorCode.Unknown)]
        public ErrorCode Code { get; set; }

        private string _description = null;
        /// <summary>
        /// 描述信息
        /// </summary>
        [JsonProperty("desc")]
        public string Description
        {
            get
            {
                if (string.IsNullOrEmpty(_description))
                {
                    _description = EnumHelper.GetEnumDesc(Code);
                }
                return _description;
            }
            set
            {
                _description = value;
            }
        }
        /// <summary>
        /// 数据
        /// </summary>
        [JsonProperty("data", NullValueHandling = NullValueHandling.Include)]
        public object Data { get; set; }


    }

}
